<template>
  <div class="tsk">
    <!-- 提示登录弹窗 -->
    <button @click="tan">点击出现弹出窗</button>
  </div>
</template>

<script>
import { MessageBox } from "mint-ui";
// 引入state函数
import { mapState } from "vuex";

export default {
  data() {
    return {};
  },
  methods: {
    tan() {
      if (this.isLogin == false) {
        MessageBox.alert("请先登录").then(action => {
          this.$router.push("/");
        });
      }
    }
  },
  // 结构变量
  computed: {
    ...mapState(["isLogin"]) //是否登录
  }
};
</script>